app.controller('foodsController', ['$scope','storageService',
    function ($scope, storageService) {
        var path = 'foods';
        $scope[path] = storageService.getItem(path);
        
        // Check for updates and update data when done
        storageService.dataUpdated(path).then(function(results){
            if(results.data !== localStorage.getItem(path + '_updated')){
                storageService.updateData(path).then(function(){
                    $scope[path] = storageService.getItem(path);
                });
            } 
        });
}]);